Skip to content

fix: removed implicit conversion felt => NodeIndex #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

nimrod-starkware
Copy link
Contributor

@nimrod-starkware nimrod-starkware commented May 8, 2024

This change is Reviewable

Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nimrod-starkware)


crates/committer/src/patricia_merkle_tree/types.rs line 41 at r1 (raw file):

    ) -> NodeIndex {
        let PathToBottom { path, length } = path_to_bottom;
        (index << length.0) + NodeIndex(U256::from_be_bytes(path.0.to_bytes_be()))

see below

Suggestion:

Self::from_felt_value(path.0)

crates/committer/src/patricia_merkle_tree/types.rs line 68 at r1 (raw file):

    }

    fn from_felt(felt: &Felt, tree_height: &TreeHeight) -> Self {

maybe better rename, to be crystal clear..
then, add a from_felt_value function (private!) for the NodeIndex(U256::from_be_bytes(felt.to_bytes_be())) logic

Suggestion:

from_leaf_felt

crates/committer/src/patricia_merkle_tree/types.rs line 69 at r1 (raw file):

    fn from_felt(felt: &Felt, tree_height: &TreeHeight) -> Self {
        Self(U256::from(1_u8) << tree_height.0) + NodeIndex(U256::from_be_bytes(felt.to_bytes_be()))

see above

Suggestion:

Self::from_felt_value(felt)

Copy link
Contributor Author

@nimrod-starkware nimrod-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @dorimedini-starkware)


crates/committer/src/patricia_merkle_tree/types.rs line 41 at r1 (raw file):

Previously, dorimedini-starkware wrote…

see below

Done.


crates/committer/src/patricia_merkle_tree/types.rs line 68 at r1 (raw file):

Previously, dorimedini-starkware wrote…

maybe better rename, to be crystal clear..
then, add a from_felt_value function (private!) for the NodeIndex(U256::from_be_bytes(felt.to_bytes_be())) logic

Done.


crates/committer/src/patricia_merkle_tree/types.rs line 69 at r1 (raw file):

Previously, dorimedini-starkware wrote…

see above

Done.

@nimrod-starkware nimrod-starkware force-pushed the nimrod/remove_implicit_from_felt_to_node_index branch from 616557a to 77fce7a Compare May 8, 2024 08:47
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nimrod-starkware)

@nimrod-starkware nimrod-starkware added this pull request to the merge queue May 8, 2024
Merged via the queue into main with commit d138ace May 8, 2024
@nimrod-starkware nimrod-starkware deleted the nimrod/remove_implicit_from_felt_to_node_index branch May 28, 2024 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants